// import { useStore } from "vuex";
// const store = useStore();
const CarData: any = {
  namespaced: true,
  state: {
    carList: [],
    input: "",
    filterList: [],
  },
  mutations: {
    SET_CARLIST(state: any, paylod) {
      // console.log(paylod, "palod");
      state.carList = paylod;
    },
    SET_INPUT(state, palod) {
      // console.log(palod, "SET_INPUT");

      state.input = palod;
      state.filterList = [];
      state.carList.forEach((item) => {
        // item是数组每一项 ['02/08/13:01', '鲁A1234', '是', '幸福小区一单元203'] 'item'
        const rule = item.indexOf(palod);
        if (rule !== -1) {
          state.filterList = item;
        }
      });

      localStorage.setItem("filterList", state.filterList);
    },
    // SET_FILTER(state: any, palod) {},
  },
  getters: {},
  actions: {},
};

export default CarData;
